<template>
  <div class="broker">
    <header>
      <div class="header">
        <li>
          <span @click="goback()">
            <a-icon type="left" />
          </span>
          <span @click="goreturn()">
            <van-icon name="wap-home-o" />
          </span>
        </li>
        <li>详情</li>
        <li>
          <span>
            <van-icon name="ellipsis" />
          </span>
          <span>
            <van-icon name="stop-circle-o" />
          </span>
        </li>
      </div>
    </header>
    <main>
      <div class="main">
        <div class="main_one">
          <div class="left">
            <p>{{info.area}}</p>
            <p>{{info.name}}</p>
            <p>
              <van-icon name="phone-o" class="icon" />
              :{{info.phone}}
            </p>
            <p>{{info.site}}</p>
          </div>
          <div class="right">
            <img :src="info.img1" alt />
          </div>
        </div>
      </div>
      <div class="main_two">
        <van-tabs v-model="active">
          <van-tab title="卖房"  >
            <div v-for="(item,index) in list" :key="index" class="tab_one">
              <img :src="item.img1" alt />
              <div>
                <p>{{item.word}}</p>
                <p>
                  <span>{{item.housescreen}}|{{item.place}}m²</span>
                  <!-- &emsp;&emsp;&emsp; -->
                  <span>{{item.plot}}</span>
                </p>
                <p>
                  <span>{{item.ares}}万&nbsp;{{item.money}}/m²</span>
                  <!-- &emsp;&emsp;&emsp; -->
                  <span>{{item.price}}天</span>
                </p>
              </div>
            </div>
          </van-tab>
          <van-tab title="买房">
              <div v-for="(item,index) in list" :key="index" class="tab_one">
              <img :src="item.imgs" alt />
              <div>
                <p>{{item.site}}</p>
                <p>
                  <span>{{item.housescreen}}|{{item.place}}m²</span>
                  <!-- &emsp;&emsp;&emsp; -->
                  <span>{{item.plot}}</span>
                </p>
                <p>
                  <span>{{item.ares}}万&nbsp;{{item.money}}/m²</span>
                  <!-- &emsp;&emsp;&emsp; -->
                  <span>{{item.price}}天</span>
                </p>
              </div>
            </div>
          </van-tab>
        </van-tabs>
      </div>
    </main>
  </div>
</template>

<script>
import axios from "../../utils/request";
export default {
  data() {
    return {
      info: [],
      active: 2,
      list: []
    };
  },
  created() {
    this.id = this.$route.params.id;
    this.getList();
    this.getLists();
  },
  methods: {
    getList() {
      axios({
        url: "/api/detail",
        method: "post",
        data: { id: this.id }
      }).then(res => {
        this.info = res.data.data;
      });
    },
    getLists() {
      axios({
        url: "/api/lists",
        method: "post"
      }).then(res => {
        this.list = res.data.data;
      });
    },
    goback(){
        this.$router.go(-1)
    },
    goreturn(){
        this.$router.push("/about")
    }
  }
};
</script>

<style scoped>
.borker {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
header {
  height: 250px;
  position: relative;
  top: 0;
  padding: 0;
  font-size: 20px;
  color: #ffffff;
  background: linear-gradient(45deg, #0f7ef4, #1988f6, #34a0fd);
}
.header {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0px 20px;
}
.header li:nth-child(2) {
  font-size: 20px;
}
.header li:nth-child(1) {
  width: 80px;
  height: 30px;
  border: 1px solid #ffffff;
  border-radius: 20px;
  display: inline-block;
}
.header li:nth-child(1) span {
  width: 50%;
  display: inline-block;
  text-align: center;
}

.header li:nth-child(3) {
  width: 80px;
  height: 30px;
  border: 1px solid #ffffff;
  border-radius: 20px;
  display: inline-block;
}
.header li:nth-child(3) span {
  width: 50%;
  display: inline-block;
  text-align: center;
}
main {
  flex: 1;
  overflow-y: auto;
}
.main {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #ffffff;
  top: 150px;
  left: 0;
  border-top-right-radius: 80px;
  border-top-left-radius: 80px;
}
.main_one {
  width: 350px;
  height: 190px;
  display: flex;
  border: 1px solid #cccccc;
  background: #ffffff;
  border-radius: 10px;
  position: absolute;
  top: -70px;
  left: 33px;
}
.main_two{
    margin-top: 30px;
}
.left {
  width: 50%;
  height: 100%;
  text-align: center;
  border-right: 3px solid orange;
}
.left p {
  margin-top: 10px;
}
.right {
  width: 50%;
  height: 100%;
}
.right img {
  width: 100%;
  height: 100%;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}
.left p:nth-child(1) {
  font-size: 16px;
}
.left p:nth-child(2) {
  font-size: 20px;
  font-weight: bold;
}
.left p:nth-child(3) {
  font-size: 14px;
  font-weight: bold;
}
.icon {
  color: indianred;
  font-size: 20px;
}
.tab_one{
    display: flex;
}
.tab_one{
    margin-top: 10px;
    margin-left: 20px;
    display: flex;
}
.tab_one p{
    margin-top: 10px;
    margin-left: 10px;
}
.tab_one img{
    width: 150px;
    height: 110px;
}
.tab_one div p{
    width: 200px;
    display: flex;
   justify-content: space-between;
}
.tab_one div p:nth-child(1){
   font-size: 18px;
   font-weight: bold;
}
.tab_one div p:nth-child(3) span{
    color: #cccccc;
    font-size: 14px;
}
</style>